import logging

from requests import Session

from config import HOST


class TenderAPI:
    def __init__(self, session: Session):
        self.__session = session

    def tender_api(self, loan_id, amount, password):
        data = {"id": loan_id, "depositCertificate": -1, "amount": amount, "password": password}
        logging.info(F"后台投资接口 / 请求方法: post / 请求url: {HOST}/trust/trust/tender / 请求数据: {data}")
        return self.__session.post(HOST + "/trust/trust/tender", data=data)

    def tripartite_tender_api(self, url, data):
        logging.info(F"三方投资接口 / 请求方法: post / 请求url: {url} / 请求数据{data}")
        return self.__session.post(url, data)
